//
//  UIView+Extention.swift
//  WeiboX
//
//  Created by admin on 30/11/2016.
//  Copyright © 2016 iOS_Objective-C. All rights reserved.
//

import UIKit

extension UIView {
	// 计算 x 坐标
	var x: CGFloat {
		get {
			return frame.origin.x
		} set {
			frame.origin.x = newValue
		}
	}
	
	// 计算 y 坐标
	var y: CGFloat {
		get {
			return frame.origin.y
		} set {
			frame.origin.y = newValue
		}
	}
	
	// 计算 width
	var width: CGFloat {
		get {
			return frame.size.width
		} set {
			frame.size.width = newValue
		}
	}
	
	// 计算 height
	var height: CGFloat {
		get {
			return frame.size.height
		} set {
			frame.size.height = newValue
		}
	}
	
	// 计算 size
	var size: CGSize {
		get {
			return frame.size
		} set {
			frame.size = newValue
		}
	}
	
	// 计算 centerX
	var centerX: CGFloat {
		get {
			return center.x
		} set {
			center.x = newValue
		}
	}
	
	// 计算 centerY
	var centerY: CGFloat {
		get {
			return center.y
		} set {
			center.y = newValue
		}
	}
}
